var t = require("../../services/api.js");

Page({
    data: {
        info: {},
        value: ""
    },
    send: function() {
        var n = this.data, a = n.value, o = n.info, e = o.ktx, i = o.min_withdraw;
        if (a = parseFloat(a), e = parseFloat(e), "" != a) {
            if (a > e) return wx.showModal({
                title: "提示",
                content: "最多可兑换".concat(e, "元"),
                showCancel: !1
            }), !1;
            if (a < i) return wx.showModal({
                title: "提示",
                content: "最低兑换".concat(i, "元"),
                showCancel: !1
            }), !1;
            wx.showLoading({
                title: "请求中",
                mask: !0
            }), (0, t.memberWithdraw)({
                money: a
            }).then(function(t) {
                wx.hideLoading(), 200 === t.data.code ? wx.showModal({
                    title: "提示",
                    content: "成功发起".concat(t.data.data.money, "元的兑换申请"),
                    showCancel: !1
                }) : wx.showModal({
                    title: "提示",
                    content: t.data.message,
                    showCancel: !1
                });
            });
        } else wx.showModal({
            title: "提示",
            content: "请输入金额",
            showCancel: !1
        });
    },
    onLoad: function(t) {},
    moenyInput: function(t) {
        this.setData({
            value: t.detail.value
        });
    },
    changeAccount: function() {
        wx.navigateTo({
            url: "/pages/alipay/index"
        });
    },
    widthAll: function() {
        this.setData({
            value: Math.floor(this.data.info.ktx)
        });
    },
    route: function() {
        wx.navigateTo({
            url: "/pages/widthdrawLists/index"
        });
    },
    onReady: function() {},
    onShow: function() {
        this.getTxInfo();
    },
    getTxInfo: function() {
        var n = this;
        (0, t.memberAccount)().then(function(t) {
            200 === t.data.code ? n.setData({
                info: t.data.data
            }) : wx.showModal({
                title: "提示",
                content: t.data.message,
                showCancel: !1,
                success: function() {
                    wx.navigateBack();
                }
            });
        });
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});